package cn.john.k8s.controller;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.management.ClassLoadingMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;

@RestController
@CrossOrigin
public class K8sController {

    @GetMapping("/info")
    public String info(){
        //获得操作系统上进程号
        RuntimeMXBean mxBean = ManagementFactory.getRuntimeMXBean();
        String name = mxBean.getName();
        return name+"----"+Thread.currentThread().getName();
    }
}
